Optimal. Leaf size=88 \[ \frac {2 b^2 B \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 \sqrt {a-b} \sqrt {a+b} d}-\frac {b B \tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {B \tan (c+d x)}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 7, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.206, Rules used = {21, 2881, 12,
2826, 3855, 2738, 211} \begin {gather*} \frac {2 b^2 B \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d \sqrt {a-b} \sqrt {a+b}}-\frac {b B \tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {B \tan (c+d x)}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 21
Rule 211
Rule 2738
Rule 2826
Rule 2881
Rule 3855
Rubi steps
\begin {align*} \int \frac {(a B+b B \cos (c+d x)) \sec ^2(c+d x)}{(a+b \cos (c+d x))^2} \, dx &=B \int \frac {\sec ^2(c+d x)}{a+b \cos (c+d x)} \, dx\\ &=\frac {B \tan (c+d x)}{a d}-\frac {B \int \frac {b \sec (c+d x)}{a+b \cos (c+d x)} \, dx}{a}\\ &=\frac {B \tan (c+d x)}{a d}-\frac {(b B) \int \frac {\sec (c+d x)}{a+b \cos (c+d x)} \, dx}{a}\\ &=\frac {B \tan (c+d x)}{a d}-\frac {(b B) \int \sec (c+d x) \, dx}{a^2}+\frac {\left (b^2 B\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{a^2}\\ &=-\frac {b B \tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {B \tan (c+d x)}{a d}+\frac {\left (2 b^2 B\right ) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 d}\\ &=\frac {2 b^2 B \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 \sqrt {a-b} \sqrt {a+b} d}-\frac {b B \tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {B \tan (c+d x)}{a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.41, size = 116, normalized size = 1.32 \begin {gather*} \frac {B \left (-\frac {2 b^2 \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+b \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+a \tan (c+d x)\right )}{a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.35, size = 125, normalized size = 1.42
method | result | size |
derivativedivides | \(\frac {2 B \left (-\frac {1}{2 a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a^{2}}+\frac {b^{2} \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{2 a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a^{2}}\right )}{d}\) | \(125\) |
default | \(\frac {2 B \left (-\frac {1}{2 a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a^{2}}+\frac {b^{2} \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {1}{2 a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a^{2}}\right )}{d}\) | \(125\) |
risch | \(\frac {2 i B}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, d \,a^{2}}+\frac {b^{2} B \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, d \,a^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B b}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B b}{a^{2} d}\) | \(221\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 165 vs.
\(2 (79) = 158\).
time = 0.49, size = 398, normalized size = 4.52 \begin {gather*} \left [-\frac {\sqrt {-a^{2} + b^{2}} B b^{2} \cos \left (d x + c\right ) \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) + {\left (B a^{2} b - B b^{3}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (B a^{2} b - B b^{3}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (B a^{3} - B a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} d \cos \left (d x + c\right )}, \frac {2 \, \sqrt {a^{2} - b^{2}} B b^{2} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) \cos \left (d x + c\right ) - {\left (B a^{2} b - B b^{3}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (B a^{2} b - B b^{3}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B a^{3} - B a b^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} d \cos \left (d x + c\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} B \int \frac {\sec ^{2}{\left (c + d x \right )}}{a + b \cos {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.49, size = 155, normalized size = 1.76 \begin {gather*} \frac {\frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} B b^{2}}{\sqrt {a^{2} - b^{2}} a^{2}} - \frac {B b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} + \frac {B b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} - \frac {2 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.06, size = 326, normalized size = 3.70 \begin {gather*} \frac {2\,B\,\left (\frac {a^3\,\sin \left (c+d\,x\right )}{2}-\frac {a\,b^2\,\sin \left (c+d\,x\right )}{2}\right )}{a^2\,d\,\cos \left (c+d\,x\right )\,\left (a^2-b^2\right )}-\frac {2\,B\,\left (a^2\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-b^3\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+b^2\,\mathrm {atanh}\left (\frac {a^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}+2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (b^2-a^2\right )}^{3/2}-2\,b^5\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}+3\,a^2\,b^3\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}-a^3\,b^2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}-a^4\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,{\left (a\,b^2-a^3\right )}^2}\right )\,\sqrt {b^2-a^2}\right )}{a^2\,d\,\left (a^2-b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________